﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
             mc:Ignorable="d"
             x:Class="LogInModule.Views.UserLogInView">

    <UserControl.Resources>
        <ResourceDictionary>
            <ec:IsArrangedToScaleConverter x:Key="IsArrangedToScaleConverter" />
            <Style x:Key="PathListBoxItemStyle"
                   TargetType="ec:PathListBoxItem">
                <Setter Property="HorizontalContentAlignment"
                        Value="Left" />
                <Setter Property="VerticalContentAlignment"
                        Value="Top" />
                <Setter Property="Background"
                        Value="Transparent" />
                <Setter Property="BorderThickness"
                        Value="1" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ec:PathListBoxItem">
                            <Grid Background="{TemplateBinding Background}"
                                  RenderTransformOrigin="0.5,0.5">
                                <Grid.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleY="{Binding IsArranged, Converter={StaticResource IsArrangedToScaleConverter}, RelativeSource={RelativeSource TemplatedParent}}"
                                                        ScaleX="{Binding IsArranged, Converter={StaticResource IsArrangedToScaleConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
                                        <SkewTransform />
                                        <RotateTransform Angle="{Binding OrientationAngle, RelativeSource={RelativeSource TemplatedParent}}" />
                                        <TranslateTransform />
                                    </TransformGroup>
                                </Grid.RenderTransform>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="CommonStates">
                                        <VisualState x:Name="Normal" />
                                        <VisualState x:Name="MouseOver">
                                        </VisualState>
                                        <VisualState x:Name="Disabled">
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="SelectionStates">
                                        <VisualState x:Name="Unselected" />
                                        <VisualState x:Name="Selected">
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="FocusStates">
                                        <VisualState x:Name="Focused">
                                        </VisualState>
                                        <VisualState x:Name="Unfocused" />
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <Rectangle x:Name="fillColor"
                                           Fill="#FFBADDE9"
                                           IsHitTestVisible="False"
                                           Opacity="0"
                                           RadiusY="1"
                                           RadiusX="1" />
                                <Rectangle x:Name="fillColor2"
                                           Fill="#FFBADDE9"
                                           IsHitTestVisible="False"
                                           Opacity="0"
                                           RadiusY="1"
                                           RadiusX="1" />
                                <ContentPresenter x:Name="contentPresenter"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}"
                                                  Content="{TemplateBinding Content}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  Margin="{TemplateBinding Padding}" />
                                <Rectangle x:Name="FocusVisualElement"
                                           RadiusY="1"
                                           RadiusX="1"
                                           Stroke="#FF6DBDD1"
                                           StrokeThickness="1"
                                           Visibility="Collapsed" />
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="BusyIndicatorStyle"
                   TargetType="toolkit:BusyIndicator">
                <Setter Property="BusyContent"
                        Value="Please wait..." />
                <Setter Property="IsTabStop"
                        Value="False" />
                <Setter Property="OverlayStyle">
                    <Setter.Value>
                        <Style TargetType="Rectangle">
                            <Setter Property="Fill"
                                    Value="White" />
                            <Setter Property="Opacity"
                                    Value="0.5" />
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="ProgressBarStyle">
                    <Setter.Value>
                        <Style TargetType="ProgressBar">
                            <Setter Property="IsIndeterminate"
                                    Value="True" />
                            <Setter Property="Height"
                                    Value="15" />
                            <Setter Property="Margin"
                                    Value="8,0,8,8" />
                        </Style>
                    </Setter.Value>
                </Setter>
                <Setter Property="DisplayAfter"
                        Value="00:00:00.1" />
                <Setter Property="HorizontalAlignment"
                        Value="Stretch" />
                <Setter Property="VerticalAlignment"
                        Value="Stretch" />
                <Setter Property="HorizontalContentAlignment"
                        Value="Stretch" />
                <Setter Property="VerticalContentAlignment"
                        Value="Stretch" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="toolkit:BusyIndicator">
                            <Grid>
                                <Grid.Resources>
                                    <Storyboard x:Name="RotateLeavesStoryboard"
                                                RepeatBehavior="Forever"
                                                AutoReverse="False">
                                        <DoubleAnimation Duration="0:0:2"
                                                         To="1"
                                                         Storyboard.TargetProperty="(PathListBox.LayoutPaths)[0].(LayoutPath.Span)"
                                                         Storyboard.TargetName="pathListBox"
                                                         d:IsOptimized="True" />
                                        <DoubleAnimation Duration="0:0:2"
                                                         To="1"
                                                         Storyboard.TargetProperty="(PathListBox.LayoutPaths)[0].(LayoutPath.Start)"
                                                         Storyboard.TargetName="pathListBox"
                                                         d:IsOptimized="True" />
                                    </Storyboard>
                                </Grid.Resources>
                                <VisualStateManager.VisualStateGroups>
                                    <VisualStateGroup x:Name="VisibilityStates">
                                        <VisualState x:Name="Hidden">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                               Storyboard.TargetName="busycontent">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Collapsed</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                               Storyboard.TargetName="overlay">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Collapsed</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Visible">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                               Storyboard.TargetName="busycontent">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Visible</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                               Storyboard.TargetName="overlay">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Visible</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                    <VisualStateGroup x:Name="BusyStatusStates">
                                        <VisualState x:Name="Idle">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetProperty="(Control.IsEnabled)"
                                                                               Storyboard.TargetName="content">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <System:Boolean>True</System:Boolean>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                        <VisualState x:Name="Busy">
                                            <Storyboard>
                                                <ObjectAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                               Duration="00:00:00.001"
                                                                               Storyboard.TargetProperty="(Control.IsEnabled)"
                                                                               Storyboard.TargetName="content">
                                                    <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <System:Boolean>False</System:Boolean>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </VisualState>
                                    </VisualStateGroup>
                                </VisualStateManager.VisualStateGroups>
                                <ContentControl x:Name="content"
                                                ContentTemplate="{TemplateBinding ContentTemplate}"
                                                Content="{TemplateBinding Content}"
                                                HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
                                <Rectangle x:Name="overlay"
                                           Style="{TemplateBinding OverlayStyle}"
                                           Opacity="0.6" />
                                <ContentPresenter x:Name="busycontent">
                                    <i:Interaction.Triggers>
                                        <ei:PropertyChangedTrigger Binding="{Binding Visibility, ElementName=busycontent}">
                                            <ei:ControlStoryboardAction Storyboard="{StaticResource RotateLeavesStoryboard}" />
                                        </ei:PropertyChangedTrigger>
                                    </i:Interaction.Triggers>
                                    <Grid HorizontalAlignment="Center"
                                          VerticalAlignment="Center">
                                        <Border BorderThickness="1"
                                                CornerRadius="2">
                                            <Border CornerRadius="1.5"
                                                    Margin="1"
                                                    Opacity="0.995">
                                                <Grid MinWidth="150"
                                                      Height="150">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition />
                                                        <RowDefinition Height="Auto" />
                                                    </Grid.RowDefinitions>
                                                    <ContentPresenter ContentTemplate="{TemplateBinding BusyContentTemplate}"
                                                                      Content="{TemplateBinding BusyContent}"
                                                                      Margin="8"
                                                                      VerticalAlignment="Bottom" />
                                                    <ec:PathListBox x:Name="pathListBox"
                                                                    Margin="-13,-14,0,0"
                                                                    HorizontalAlignment="Left"
                                                                    Height="15"
                                                                    VerticalAlignment="Top"
                                                                    Width="13"
                                                                    ItemContainerStyle="{StaticResource PathListBoxItemStyle}">
                                                        <ec:PathListBox.LayoutPaths>
                                                            <ec:LayoutPath SourceElement="{Binding ElementName=rode}" />
                                                        </ec:PathListBox.LayoutPaths>
                                                        <Image Height="30"
                                                               Width="30"
                                                               Source="images/papaya leaf.png" />
                                                        <Image Height="30"
                                                               Width="30"
                                                               Source="images/leaf (1).png" />
                                                        <Image Height="30"
                                                               Width="30"
                                                               Source="images/leaf (2).png" />
                                                        <Image Height="30"
                                                               Width="30"
                                                               Source="images/Birch leaf.png" />
                                                    </ec:PathListBox>
                                                    <Path x:Name="rode"
                                                          Data="M16,50 C76,47 37.999763,117.00198 89.999763,96.001984 C141.99976,75.001984 128.99968,104.00284 122,54.99995 C111.8885,-15.788024 77.999832,-10.002843 68.999832,34.99947"
                                                          Margin="15.5,0.916,20.757,49.564"
                                                          Stretch="Fill"
                                                          UseLayoutRounding="False"
                                                          StrokeThickness="2" />
                                                </Grid>
                                            </Border>
                                        </Border>
                                    </Grid>
                                </ContentPresenter>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style TargetType="TextBox"
                   x:Key="LogInInputFieldStyle">
                <Setter Property="Height"
                        Value="32" />
                <Setter Property="FontSize" 
                        Value="16"/>
                <Setter Property="Foreground"
                        Value="Gray" />
                <Setter Property="Margin"
                        Value="5" />
                <Setter Property="Width"
                        Value="280" />
                <Setter Property="BorderBrush"
                        Value="#FF5A730E" />
                <Setter Property="BorderThickness"
                        Value="2" />
            </Style>

            <Style TargetType="TextBlock"
                   x:Key="LogInLabelStyle">
                <Setter Property="HorizontalAlignment"
                        Value="Right" />
                <Setter Property="Foreground"
                        Value="White" />
                <Setter Property="FontFamily"
                        Value="Segoe UI" />
                <Setter Property="Margin"
                        Value="0 0 10 0" />
                <Setter Property="FontSize"
                        Value="22.667" />
            </Style>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/YourWorld.Common;component/Styles/CommonResourcesDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot"
          VerticalAlignment="Center"
          HorizontalAlignment="Center"
          Height="470"
          Width="900"
          Margin="80,30,0,0">
    	<VisualStateManager.VisualStateGroups>
    		<VisualStateGroup x:Name="LoginStates">
    			<VisualStateGroup.Transitions>
    				<VisualTransition GeneratedDuration="0:0:0.3">
    					<VisualTransition.GeneratedEasingFunction>
    						<CircleEase EasingMode="EaseOut"/>
    					</VisualTransition.GeneratedEasingFunction>
    				</VisualTransition>
    			</VisualStateGroup.Transitions>
    			<VisualState x:Name="NormalState"/>
    			<VisualState x:Name="LoadGuestState">
    				<Storyboard>
    					<DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="guestStackPanel" d:IsOptimized="True"/>
    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="guestStackPanel">
    						<DiscreteObjectKeyFrame KeyTime="0">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    					</ObjectAnimationUsingKeyFrames>
    					<DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="stackPanel" d:IsOptimized="True"/>
    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="stackPanel">
    						<DiscreteObjectKeyFrame KeyTime="0">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Collapsed</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    					</ObjectAnimationUsingKeyFrames>
    				</Storyboard>
    			</VisualState>
    		</VisualStateGroup>
    	</VisualStateManager.VisualStateGroups>
        <toolkit:BusyIndicator Grid.Column="1"
                               IsBusy="{Binding IsBusy}"
                               Margin="0"
                               Style="{StaticResource BusyIndicatorStyle}" HorizontalAlignment="Center" VerticalAlignment="Center">
            <Border BorderBrush="Transparent"
                    BorderThickness="3">
                <Grid Background="Transparent">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Grid Margin="0 15 0 0">
                        <Grid x:Name="LoginPanel"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Top">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="210" />
                                <ColumnDefinition Width="290" />
                                <ColumnDefinition Width="73" />
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Column="1">
                                <TextBlock FontSize="50"
                                           Foreground="White"
                                           HorizontalAlignment="Center"
                                           FontFamily="Segoe UI"
                                           VerticalAlignment="Center"
                                           TextAlignment="Center"
                                           Text="Welcome!"
                                           Margin="0 30 0 30" />
                            </Grid>
                            <TextBlock Grid.Column="0"
                                       Grid.Row="1"
                                       Text="Email"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <TextBox Grid.Column="1"
                                     Grid.Row="1"
                                     Text="{Binding Email, Mode=TwoWay}"
                                     Style="{StaticResource LogInInputFieldStyle}" />
                            <TextBlock Grid.Column="0"
                                       Grid.Row="2"
                                       Text="Password"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <PasswordBox    x:Name="LogInPassword"
                                            Grid.Column="1"
                                            FontSize="16"
                                            Grid.Row="2"
                                            Password="{Binding Password, Mode=TwoWay}"
                                            Margin="5"
                                            Height="32"
                                            Foreground="Gray"
                                            Width="280"
                                            BorderBrush="#FF5A730E"
                                            BorderThickness="2" />
                            <Button Grid.Row="3"
                                    Grid.Column="1"
                                    Command="{Binding LoginCommand}"
                                    x:Name="LoginButton"
                                    Content=" Log In "
                                   HorizontalAlignment="Center"                                    
                                    Style="{StaticResource GwButtonStyle}" />
                            <StackPanel Grid.Row="4"
                                        Grid.Column="1"
                                        Orientation="Horizontal"
                                        Margin="3"
                                        HorizontalAlignment="Center">
                                <HyperlinkButton Content="Register"
                                                 x:Name="LogInToRegister"
                                                 FontFamily="Segoe UI"
                                                 Foreground="White"
                                                 FontSize="14" />
												  <HyperlinkButton Content="Edit profile"
                                                 x:Name="LogInToEdit"
                                                 FontFamily="Segoe UI"
                                                 Foreground="White"
                                                 FontSize="14" />
                            </StackPanel>
                            <StackPanel x:Name="stackPanel" Grid.Row="5"
                                        Grid.Column="1"
                                        Orientation="Horizontal"
                                        Margin="3"
                                        HorizontalAlignment="Center">
                               
                                <HyperlinkButton Content="Play as Guest"
                                	x:Name="PlayGuest"
                                	FontFamily="Segoe UI"
                                	Foreground="White"
                                	FontSize="14" >
                                	<i:Interaction.Triggers>
                                		<i:EventTrigger EventName="Click">
                                			<ei:GoToStateAction StateName="LoadGuestState"/>
                                		</i:EventTrigger>
                                	</i:Interaction.Triggers>
                                </HyperlinkButton>
									</StackPanel>
									<StackPanel x:Name="guestStackPanel" Grid.Row="6"
                                        Grid.Column="1" HorizontalAlignment="Right"
										Grid.ColumnSpan="2"
                                        Orientation="Horizontal"
                                        Margin="3" Visibility="Collapsed" Opacity="0">
									<StackPanel> <TextBlock FontSize="14" HorizontalAlignment="Left"
                                       Text="Enter Your nickname:"
                                       Style="{StaticResource LogInLabelStyle}" Margin="5,0,10,-6" />
									   
									 <TextBox Text="{Binding Nickname, Mode=TwoWay}"
                                     Style="{StaticResource LogInInputFieldStyle}" Margin="5,11,5,10" Width="280" />
									 </StackPanel>
									 <Button VerticalAlignment="Bottom"
                                        Command="{Binding GuestPlayCommand}"
                                    x:Name="PlayGuestButton"
                                    Content=" GO "
                                   HorizontalAlignment="Center"                                    
                                    Style="{StaticResource GwButtonStyle}" />
                            </StackPanel>
                            <TextBlock Grid.Column="1"
                                       Grid.Row="7"
                                       Margin="0,10,0,0"
                                       Foreground="White"
                                       Text="{Binding ErrorMessage}"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center" />
                        </Grid>

                        <Grid x:Name="RegisterPanel"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Top"
                              Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="210" />
                                <ColumnDefinition Width="290" />
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Column="1"
                                  Height="120">
                                <TextBlock FontSize="50"
                                           Foreground="White"
                                           FontFamily="Segoe UI"
                                           VerticalAlignment="Center"
                                           TextAlignment="Center"
                                           Text="Register"
                                           Margin="0 40 0 0" />
                            </Grid>
                            <TextBlock Grid.Column="0"
                                       Grid.Row="1"
                                       Text="Username"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <TextBox Grid.Column="1"
                                     Grid.Row="1"
                                     Text="{Binding Username, Mode=TwoWay}"
                                     Style="{StaticResource LogInInputFieldStyle}" />
                            <TextBlock Grid.Column="0"
                                       Grid.Row="2"
                                       Text="Email"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <TextBox Grid.Column="1"
                                     Grid.Row="2"
                                     Text="{Binding Email, Mode=TwoWay}"
                                     Style="{StaticResource LogInInputFieldStyle}" />
                            <TextBlock Grid.Column="0"
                                       Grid.Row="3"
                                       Text="Password"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <PasswordBox Grid.Column="1"
                                         Grid.Row="3"
                                         FontSize="16"
                                         Password="{Binding Password, Mode=TwoWay}"
                                         Margin="5"
                                         Height="32"
                                         Foreground="Gray"
                                         Width="280"
                                         BorderBrush="#FF5A730E"
                                         BorderThickness="2" />
                            <TextBlock Grid.Column="0"
                                       Grid.Row="4"
                                       Text="Repeat"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <PasswordBox Grid.Column="1"
                                         Grid.Row="4"
                                         FontSize="16"
                                         Password="{Binding RepeatPassword, Mode=TwoWay}"
                                         Margin="5"
                                         Height="32"
                                         Foreground="Gray"
                                         Width="280"
                                         BorderBrush="#FF5A730E"
                                         BorderThickness="2" />
                            <Button Grid.Row="5"
                                    Grid.Column="1"
                                    Command="{Binding RegisterCommand}"
                                    x:Name="RegisterButton"
                                    Content="Register"
                                    Margin="10"
                                    Width="100"
                                    Height="40"
                                    Style="{StaticResource GwButtonStyle}" />
                            <StackPanel Grid.Row="6"
                                        Grid.Column="1"
                                        Orientation="Horizontal"
                                        Margin="3"
                                        HorizontalAlignment="Center">
                                <HyperlinkButton Content="Log in"
                                                 x:Name="RegisterToLogIn"
                                                 FontFamily="Segoe UI"
                                                 Foreground="White"
                                                 FontSize="14" />
                            </StackPanel>
                            <TextBlock Grid.Column="1"
                                       Grid.Row="7"
                                       Margin="0 10 0 0"
                                       Foreground="White"
                                       Text="{Binding ErrorMessage}"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center" />
                        </Grid>

                        <Grid x:Name="EditPanel"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Top"
                              Visibility="Collapsed">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="210" />
                                <ColumnDefinition Width="290" />
                            </Grid.ColumnDefinitions>
                            <Grid Grid.Column="1"
                                  Height="160">
                                <TextBlock Foreground="White"
                                           FontSize="30"
                                           Margin="0 30 0 0"
                                           VerticalAlignment="Center"
                                           TextAlignment="Center"
                                           Text="{Binding Email}"
                                           FontFamily="Segoe UI" />
                            </Grid>
                            <TextBlock Grid.Column="0"
                                       Grid.Row="1"
                                       Text="Username"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <TextBox Grid.Column="1"
                                     Grid.Row="1"
                                     Text="{Binding Username, Mode=TwoWay}"
                                     Style="{StaticResource LogInInputFieldStyle}" />
                            <TextBlock Grid.Column="0"
                                       Grid.Row="2"
                                       Text="New password"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <PasswordBox Grid.Column="1"
                                         Grid.Row="2"
                                         FontSize="16"
                                         Password="{Binding Password, Mode=TwoWay}"
                                         Margin="5"
                                         Height="32"
                                         Foreground="Gray"
                                         Width="280"
                                         BorderBrush="#FF5A730E"
                                         BorderThickness="2" />
                            <TextBlock Grid.Column="0"
                                       Grid.Row="3"
                                       Text="Repeat password"
                                       Style="{StaticResource LogInLabelStyle}" />
                            <PasswordBox Grid.Column="1"
                                         Grid.Row="3"
                                         FontSize="16"
                                         Password="{Binding RepeatPassword, Mode=TwoWay}"
                                         Margin="5"
                                         Height="32"
                                         Foreground="Gray"
                                         Width="280"
                                         BorderBrush="#FF5A730E"
                                         BorderThickness="2" />
                            <Button Grid.Row="4"
                                    Grid.Column="1"
                                    Command="{Binding UpdateCommand}"
                                    x:Name="EditButton"
                                    Content="Update"
                                    Margin="10"
                                    Width="100"
                                    Height="40"
                                    Style="{StaticResource GwButtonStyle}" />
                            <StackPanel Grid.Row="5"
                                        Grid.Column="1"
                                        Orientation="Horizontal"
                                        Margin="3"
                                        HorizontalAlignment="Center">
                                <HyperlinkButton Content="Log in"
                                                 x:Name="EditToLogIn"
                                                 FontFamily="Segoe UI"
                                                 Foreground="White"
                                                 FontSize="14" />
                            </StackPanel>
                            <TextBlock Grid.Column="1"
                                       Grid.Row="6"
                                       Margin="0 10 0 0"
                                       FontFamily="Segoe UI"
                                       Foreground="White"
                                       Text="{Binding ErrorMessage}"
                                       VerticalAlignment="Center"
                                       HorizontalAlignment="Center" />
                        </Grid>

                    </Grid>


                    <HyperlinkButton NavigateUri="http://www.un.org/en/events/iyof2011/"
                                     Grid.Column="2"
                                     Grid.RowSpan="2"
                                     VerticalAlignment="Center"
                                     HorizontalAlignment="Center"
                                     TargetName="_blank">
                        <HyperlinkButton.Template>
                            <ControlTemplate TargetType="HyperlinkButton">
                                <ContentPresenter Content="{TemplateBinding Content}" />
                            </ControlTemplate>
                        </HyperlinkButton.Template>
                        <Border Width="200"
                                Height="200"
                                Background="White"
                                BorderBrush="#FFF10000"
                                CornerRadius="25">
                            <Border Height="190">
                                <Border.Background>
                                    <ImageBrush ImageSource="images/UN_logo.jpg"
                                                Stretch="Uniform"></ImageBrush>
                                </Border.Background>
                            </Border>
                        </Border>
                    </HyperlinkButton>


                </Grid>
            </Border>

        </toolkit:BusyIndicator>
    </Grid>
</UserControl>